package action;

import com.opensymphony.xwork2.ActionSupport;
import domain.Book;
import service.BookService;

public class BookAction extends ActionSupport {
    private BookService bookService;
    private Book book;

    public String add(){
        int result = bookService.addBook(book);
        if(result > 0){
            addActionMessage("图书添加成功！");
            return SUCCESS;
        }else{
            addActionError("图书添加失败！");
            return ERROR;
        }
    }

    public void setBookService(BookService bookService) {
        this.bookService = bookService;
    }

    public BookService getBookService() {
        return bookService;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }
}
